import React from "react";
import {createPortal} from "react-dom";

export default function PortalDialog(props) {

    // 使用了portal：将Dialog组件分配到document.body下 不受App组件影响
    return createPortal(<div style={{
        width: '100%',
        height: '100%',
        backgroundColor: 'rgba(0,0,0,.7)',
        left: 0,
        top: 0,
        position: 'fixed',
        zIndex: 999
    }}>
        <button onClick={props.close}>关闭</button>
    </div>, document.body);
}